<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改招聘')" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-recruit-edit" th:object="${metaRecruit}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">说明：</label>
                <div class="col-sm-8">
                    <input name="remark" th:field="*{remark}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">真实姓名：</label>
                <div class="col-sm-8">
                    <input name="realName" th:field="*{realName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">应聘岗位：</label>
                <div class="col-sm-8">
                    <select name="recruit" class="form-control m-b" th:with="type=${@dict.getType('wretchant_recruit')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{recruit}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">性别：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('wretchant_sex')}">
                        <input type="radio" th:id="${'sex_' + dict.dictCode}" name="sex" th:value="${dict.dictValue}" th:field="*{sex}" required>
                        <label th:for="${'sex_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">到岗时间：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('wretchant_arrival_time')}">
                        <input type="radio" th:id="${'arrivalTime_' + dict.dictCode}" name="arrivalTime" th:value="${dict.dictValue}" th:field="*{arrivalTime}">
                        <label th:for="${'arrivalTime_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">离职状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('wretchant_resignation_status')}">
                        <input type="radio" th:id="${'resignationStatus_' + dict.dictCode}" name="resignationStatus" th:value="${dict.dictValue}" th:field="*{resignationStatus}">
                        <label th:for="${'resignationStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">通勤时间：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('wretchant_commuting_time')}">
                        <input type="radio" th:id="${'commutingTime_' + dict.dictCode}" name="commutingTime" th:value="${dict.dictValue}" th:field="*{commutingTime}">
                        <label th:for="${'commutingTime_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">教育程度：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('wretchant_education')}">
                        <input type="radio" th:id="${'education_' + dict.dictCode}" name="education" th:value="${dict.dictValue}" th:field="*{education}">
                        <label th:for="${'education_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">背景调查：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                        <input type="radio" th:id="${'backgroundInvestigation_' + dict.dictCode}" name="backgroundInvestigation" th:value="${dict.dictValue}" th:field="*{backgroundInvestigation}">
                        <label th:for="${'backgroundInvestigation_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">薪资调查：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                        <input type="radio" th:id="${'salarySurvey_' + dict.dictCode}" name="salarySurvey" th:value="${dict.dictValue}" th:field="*{salarySurvey}">
                        <label th:for="${'salarySurvey_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否接受出差：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                        <input type="radio" th:id="${'businessTravel_' + dict.dictCode}" name="businessTravel" th:value="${dict.dictValue}" th:field="*{businessTravel}">
                        <label th:for="${'businessTravel_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">面试情况：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('wretchant_interview_situation')}">
                        <input type="radio" th:id="${'interviewSituation_' + dict.dictCode}" name="interviewSituation" th:value="${dict.dictValue}" th:field="*{interviewSituation}">
                        <label th:for="${'interviewSituation_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">目前薪资：</label>
                <div class="col-sm-8">
                    <input name="currentSalary" th:field="*{currentSalary}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">期望薪资：</label>
                <div class="col-sm-8">
                    <input name="salaryExpectation" th:field="*{salaryExpectation}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">简历地址：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="resumeAddress" th:field="*{resumeAddress}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="resumeAddress" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">离职原因：</label>
                <div class="col-sm-8">
                    <input name="reasonsForResignation" th:field="*{reasonsForResignation}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">作品集地址：</label>
                <div class="col-sm-8">
                    <textarea name="workAddress" class="form-control">[[*{workAddress}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">一面评价：</label>
                <div class="col-sm-8">
                    <input type="hidden" class="form-control" th:field="*{firstEvaluate}">
                    <div class="summernote" id="firstEvaluate"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">二面评价：</label>
                <div class="col-sm-8">
                    <input type="hidden" class="form-control" th:field="*{secondEvaluate}">
                    <div class="summernote" id="secondEvaluate"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">三面评价：</label>
                <div class="col-sm-8">
                    <input type="hidden" class="form-control" th:field="*{thirdEvaluate}">
                    <div class="summernote" id="thirdEvaluate"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">学信网学历编号：</label>
                <div class="col-sm-8">
                    <input name="studyNumber" th:field="*{studyNumber}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">学信网学历截图：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="studyNumberFile" th:field="*{studyNumberFile}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="studyNumberFile" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">薪资流水截图：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="salaryFile" th:field="*{salaryFile}">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="salaryFile" name="file" type="file">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <th:block th:include="include :: summernote-js" />
    <script th:inline="javascript">
        var prefix = ctx + "wretchant/recruit";
        $("#form-recruit-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-recruit-edit').serialize());
            }
        }

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx + 'common/upload',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });

        $(function() {
            $('.summernote').each(function(i) {
                $('#' + this.id).summernote({
                    lang: 'zh-CN',
                    dialogsInBody: true,
                    callbacks: {
                        onChange: function(contents, $edittable) {
                            $("input[name='" + this.id + "']").val(contents);
                        },
                        onImageUpload: function(files) {
                            var obj = this;
                            var data = new FormData();
                            data.append("file", files[0]);
                            $.ajax({
                                type: "post",
                                url: ctx + "common/upload",
                                data: data,
                                cache: false,
                                contentType: false,
                                processData: false,
                                dataType: 'json',
                                success: function(result) {
                                    if (result.code == web_status.SUCCESS) {
                                        $('#' + obj.id).summernote('insertImage', result.url);
                                    } else {
                                        $.modal.alertError(result.msg);
                                    }
                                },
                                error: function(error) {
                                    $.modal.alertWarning("图片上传失败。");
                                }
                            });
                        }
                    }
                });
                var content = $("input[name='" + this.id + "']").val();
                $('#' + this.id).summernote('code', content);
            })
        });
    </script>
</body>
</html>